package com.cs.pk.utils;

import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Control;

public class FontUtil {
	
	
	public static Font adjustFont(Control control, int size,int style){
		FontData[] fontData = control.getFont().getFontData();
		for (int i= 0; i < fontData.length; i++) {
			if(size !=-1){
			fontData[i].setHeight(size);
			}
			if(style!=-1){
				fontData[i].setStyle(style);
			}
		}
		Font newFont = new Font(control.getDisplay(), fontData);
		control.setFont(newFont);
		return newFont;
	}

}
